import Ember from 'ember';

export default Ember.Controller.extend({
    constants: Constants,
    queryCondition: '',
    mainController: Ember.inject.controller('business.mainpage'),
    actions: {
        toDetailPage(tenant) {
            if (tenant) {
                let id = tenant.get('id');
                console.log('length-------' + tenant.get('privileges').get('length'));
                if (tenant.get('privileges').get('length') === 0) {
                    this.get("mainController").switchMainPage('tenant-detail', {
                        id: id,
                        editMode: "addRole"
                    });
                } else {
                    this.get("mainController").switchMainPage('tenant-detail', {
                        id: id,
                        editMode: "editRole"
                    });
                }
            } else {
                this.get("mainController").switchMainPage('tenant-detail', {
                    editMode: "add",
                    id: ''
                });
            }
        },
    }
});
